{layout name="layout/layout" /}
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">意见反馈列表</li>
    </ul>
</div>
<form>
    <select name="condition_type" id="search" class="selected">
        <option {if($condition[ "condition_type"]=='' )}selected{/if} value="">全部</option>
        <option {if($condition[ "condition_type"]=='project_id' )}selected{/if} value="project_id">项目名</option>
        <option {if($condition[ "condition_type"]=='tel' )}selected{/if} value="tel">电话</option>
    </select>
    <div class="layui-inline">
        <input style="display: none" class=" ee layui-input text" type="text" name="condition_val">

    </div>
    <div class="layui-inline">

        <button class="layui-btn" data-type="reload">查询</button>
    </div>
</form>
<div class="layui-form">
    <table class="layui-table">
        <colgroup>
            <col width="15%">
            <col width="8%">
            <col width="7%">
            <col width="25%">
            <col width="7%">
            <col width="5%">
            <col width="8%">
            <col width="25%">
        </colgroup>
        <thead>
            <tr style="background-color: #f5f5f5;font-size: 17px">
                <td>分类</td>
                <td>建议类型</td>
                <td>建议类容</td>
                <td>建议图片</td>
                <td>联系电话</td>
                <td>用户</td>
                <td>添加时间</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            {if(isset($data) && $data)} 
            {foreach $data as $k=>$v}
            <tr>
                <td>
                    {if condition="($v->type == 1)"}
                    <span style="color: red">项目反馈（{$v->project_id}）</span>
                    {elseif condition="$v->type == 2"/}
                    <span>普通反馈</span>
                    {/if}
                </td>
                <td>
                    {$v->title_name} &nbsp;
                </td>
                <td>
                    {$v->content} &nbsp;
                </td>
                <td class="feedback_img">
                    {if($v->srcs)} {foreach $v->srcs as $v1}
                    <img style="width: 50px" src="{$v1}" /> {/foreach} {else /} 暂无图片 {/if} &nbsp;
                </td>
                <td>
                    {$v->tel} &nbsp;
                </td>
                <td>
                    {$v->user_name} &nbsp;
                </td>

                <td>
                    {$v->created_at|date="Y-m-d",###}

                </td>
                <td>
                    <a class="dell layui-btn layui-btn-danger layui-btn-xs" opinion_id="{$v->id}" href="#">删除</a>
                    {if($v->reply)}
                    <a  class="layui-btn layui-btn-primary layui-btn-xs" href="{:Url('admin/opinion/edit',['id'=>$v->id])}">已回复</a>
                    {else /}
                    <a  class="layui-btn layui-btn-primary layui-btn-xs"  href="{:Url('admin/opinion/reply',['id'=>$v->id])}">回复</a>
                    {/if}

                </td>
            </tr>
            {/foreach} {/if}
        </tbody>
    </table>
    {$page}
</div>















<script src="/static/layer/layer.js"></script>
<script>
    var type = $('#search').val();
    condition(type);

    $('#search').change(function () {
        var type = $(this).val();
        condition(type);
    });
    function condition(type) {
        $('.ee').css('display', 'none');
        if (type == '') {
            $('.ee').css('display', 'none');
        } else{
            $('.text').css('display', 'block');

        }
    }
    //时间大小对比 start





    $('.dell').click(function () {
        var id = $(this).attr('opinion_id');
        layer.confirm('是否确认删除？', {
            btn: ['确认', '取消'] //按钮
        }, function () {
            $.post("{:Url('admin/opinion/del')}", { opinion_id: id }, function (data) {
                window.location.reload();
                if (!data) {
                    layer.msg('删除失败');
                }
            });
        })
    });

    PostbirdImgGlass.init({
        domSelector: ".feedback_img img",
        animation: true
    });
</script>